home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Knitting.iso / App / Patterns.dxr / behaviors_92_Click Behavior (Sound) main.ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  2.7 KB  |  72 lines

  1. property DownSnd, UpSnd, Action, WhichLabel, standardImage, alternateImage
  2.  
  3. on mouseDown
  4.   click(DownSnd, UpSnd)
  5.   if Action = "Go to marker" then
  6.     go(WhichLabel)
  7.   else
  8.     if Action = "Play marker" then
  9.       play frame WhichLabel
  10.     end if
  11.   end if
  12. end
  13.  
  14. on beginSprite me
  15.   me.standardImage = the member of sprite me.spriteNum
  16.   memref = the member of sprite the currentSpriteNum
  17.   castLibNum = memref.castLibNum
  18.   alternateImage = member(memref.memberNum + 1, castLibNum)
  19. end
  20.  
  21. on mouseEnter me
  22.   set the member of sprite the spriteNum of me to me.alternateImage
  23.   set the memberNum of sprite (the spriteNum of me + 1) to the memberNum of sprite (me.spriteNum + 1) + 1
  24. end
  25.  
  26. on mouseLeave me
  27.   if the mouseUp then
  28.     set the member of sprite the spriteNum of me to me.standardImage
  29.     set the memberNum of sprite (the spriteNum of me + 1) to the memberNum of sprite (me.spriteNum + 1) - 1
  30.   end if
  31. end
  32.  
  33. on getPropertyDescriptionList
  34.   global ibcDefaultParams
  35.   if the currentSpriteNum = 0 then
  36.     memdefault = 0
  37.   else
  38.     memref = the member of sprite the currentSpriteNum
  39.     castLibNum = memref.castLibNum
  40.     memdefault = member(memref.memberNum + 1, castLibNum)
  41.   end if
  42.   if listp(ibcDefaultParams) then
  43.     return ibcDefaultParams
  44.   else
  45.     description = [:]
  46.     addProp(description, #Action, [#default: "None", #range: ["None", "Go to marker", "Play marker"], #format: #symbol, #comment: "MouseUp Action:"])
  47.     addProp(description, #WhichLabel, [#comment: "Destination Marker:", #format: #marker, #default: "next"])
  48.     return description
  49.   end if
  50. end
  51.  
  52. on getBehaviorDescription
  53.   return "- Click Behavior -" & RETURN & "Defined: controls a dual-image button." & RETURN & "Intended Use: to give user a simple audio + visual feedback that they've engaged a control. Rolling off button during mouseDown will disengage." & RETURN & RETURN & "- Properties -" & RETURN & "Down Sound: assigns a mouseDown button sound." & RETURN & "Up Sound: assigns a mouseUp button sound." & RETURN & "MouseUp Action: assigns a button course of action." & RETURN & "  (Note: Select 'None' if you plan to add a seperate mouseUp behavior to this button)" & RETURN & "Destination Marker: assigns a destination to the course of action." & RETURN & RETURN & "(Explore the 'LookHere' folder on the CD-Rom for examples of each behavior)"
  54. end
  55.  
  56. on click
  57.   emem = the memberNum of sprite clickOn()
  58.   updateStage()
  59.   set the memberNum of sprite clickOn() to emem + 1
  60.   updateStage()
  61.   repeat while the stillDown
  62.     if rollover(clickOn()) then
  63.       set the memberNum of sprite clickOn() to emem + 1
  64.     else
  65.       set the memberNum of sprite clickOn() to emem - 1
  66.     end if
  67.     updateStage()
  68.   end repeat
  69.   set the memberNum of sprite clickOn() to emem
  70.   updateStage()
  71. end
  72.